-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustc: fix building with llvm #320432
rustc: fix building with llvm #320432
Conversation
e05dbb6
to
8f443be
Compare
I still get this on x86_64-linux:
|
@tomberek Yes, this seems to still occur on aarch64-linux as well. Not entirely sure why we are still facing this issue. Looking at the documentation comments in |
8f443be
to
b966a22
Compare
@ofborg build pkgsLLVM.rustc |
On x86_64-linux I'm getting:
|
@jopejoe1 Thank you for testing, I marked it as a draft and will continue figuring out why rustc still doesn't compile tonight. |
perhaps we should be compiling the pkgsLLVM clang so that it translates the alternatively, adding the flag -stdlib=libc++ should also work |
e73636c
to
1108be3
Compare
Rustc builds now 🎉 (Will let CI run through and if labels do not change, will retarget for staging) |
@ofborg build pkgsLLVM.rustc |
8394848
to
8b96d40
Compare
8b96d40
to
0c3cbd2
Compare
@@ -66,14 +67,14 @@ in stdenv.mkDerivation (finalAttrs: { | |||
# when linking stage1 libstd: cc: undefined reference to `__cxa_begin_catch' | |||
# This doesn't apply to cross-building for FreeBSD because the host | |||
# uses libstdc++, but the target (used for building std) uses libc++ | |||
optional (stdenv.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD) "--push-state --as-needed -lstdc++ --pop-state" | |||
optional (stdenv.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD && !useLLVM) "--push-state --as-needed -lstdc++ --pop-state" | |||
++ optional (stdenv.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD && useLLVM) "--push-state --as-needed -L${llvmPackages.libcxx}/lib -lc++ -lc++abi -lLLVM-${lib.versions.major llvmPackages.llvm.version} --pop-state" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ optional (stdenv.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD && useLLVM) "--push-state --as-needed -L${llvmPackages.libcxx}/lib -lc++ -lc++abi -lLLVM-${lib.versions.major llvmPackages.llvm.version} --pop-state" | |
++ optional (stdenv.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD && useLLVM) | |
"--push-state --as-needed -L${llvmPackages.libcxx}/lib -lc++ -lc++abi -lLLVM-${lib.versions.major llvmPackages.llvm.version} --pop-state" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -66,14 +67,14 @@ in stdenv.mkDerivation (finalAttrs: { | |||
# when linking stage1 libstd: cc: undefined reference to `__cxa_begin_catch' | |||
# This doesn't apply to cross-building for FreeBSD because the host | |||
# uses libstdc++, but the target (used for building std) uses libc++ | |||
optional (stdenv.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD) "--push-state --as-needed -lstdc++ --pop-state" | |||
optional (stdenv.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD && !useLLVM) "--push-state --as-needed -lstdc++ --pop-state" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional (stdenv.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD && !useLLVM) "--push-state --as-needed -lstdc++ --pop-state" | |
optional (stdenv.isLinux && !withBundledLLVM && !stdenv.targetPlatform.isFreeBSD && !useLLVM) | |
"--push-state --as-needed -lstdc++ --pop-state" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
0c3cbd2
to
f9d3bb5
Compare
f9d3bb5
to
36219b4
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/4278 |
For aarch64-darwin:
|
36219b4
to
2c03b10
Compare
@tomberek I've pushed a change which I believe might fix it, if it doesn't then I'll do some more diagnosing tonight. |
Builds on x86_64-linux. |
Bisect says 6a163e2
|
@trofi Will take a look at it tonight. Tbf, it probably wouldn't even have built anyway so it's not like we totally broke everything. |
My concern is the eval only (I usually scan for things in treewide evals). It used to eval successfully and does not anymore. |
Heh yeah, I'll take a look tonight after work to try fixing this. Unless someone else wants to touch this. |
The PR which fixed `useLLVM` native rustc builds (NixOS#320432) also broke cross builds. The C compiler it used for `llvmShared` and `llvmPackages`, `llvmPackages.clangUseLLVM`, was built to run on the host and create binaries for the target (`pkgsHostTarget`). Instead, the compiler should be built to run on the build machine and produce binaries for the build machine (`pkgsBuildHost`). Replace the overridden compilers with ones from `pkgsBuildHost` Co-Authored-By: Artemis Tosini <me@artem.ist>
The PR which fixed `useLLVM` native rustc builds (NixOS#320432) also broke cross builds. The C compiler it used to produce `llvmShared` and `llvmPackages`, `llvmPackages.clangUseLLVM`, was built to run on the host and create binaries for the target (`pkgsHostTarget`). Instead, the compiler should be built to run on the build machine and produce binaries for the host machine (`pkgsBuildHost`). Replace the overridden compilers with ones from `pkgsBuildHost` Co-Authored-By: Artemis Tosini <me@artem.ist>
The PR which fixed `useLLVM` native rustc builds (NixOS#320432) also broke cross builds. The C compiler it used to produce `llvmShared` and `llvmPackages`, `llvmPackages.clangUseLLVM`, was built to run on the host and create binaries for the target (`pkgsHostTarget`). Instead, the compiler should be built to run on the build machine and produce binaries for the host machine (`pkgsBuildHost`). Replace the overridden compilers with ones from `pkgsBuildHost` Co-Authored-By: Artemis Tosini <me@artem.ist>
Description of changes
Fixes #311930
Can be tested / reproduced by building
pkgsLLVM.rustc
. Fix was tested under the Nixpkgs LLVM Workspace project.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.